﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using TakeoutMangesBLL;
using Model;

namespace TakeoutMangesWeb
{
    public partial class shopinfo : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Usersession"]!= null)
            {
                logininfo.Attributes.Add("Style", "display:none");
                showinfo.Attributes.Add("Style", "display:block");
                Models.Usersession us =Session["Usersession"] as Models.Usersession;
                user.InnerHtml = us.UserName;
            }
            else
            {
                logininfo.Attributes.Add("Style", "display:block");
                showinfo.Attributes.Add("Style", "display:none");
            }
            if (!IsPostBack) 
            {
                getProduct();
            }
        }

        public void getProduct() 
        {
            string Name = txtName.Value.Trim();
            RP_Product.DataSource = ProductBLL.getProduct(Name);
            RP_Product.DataBind();
        }

        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            Session["Usersession"] = null;
            Session.Remove("Usersession");
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Response.Redirect("Login.aspx");
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            getProduct();
        }

        protected void Button3_Click(object sender, EventArgs e)
        {
            Response.Redirect("ShopCar.aspx");
        }
    }
}